package cn.ingrun.first_spring_cloud_client2.controller;


import cn.ingrun.first_spring_cloud_client2.models.ResponseJson;
import cn.ingrun.first_spring_cloud_client2.remote.Hello;
import cn.ingrun.first_spring_cloud_client2.utils.MyResponse;
import org.apache.commons.lang.text.StrTokenizer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestHello {

    private Hello hello;

    @Autowired
    public void setHello(Hello h) {
        this.hello = h;
    }

    @GetMapping("testHello")
    public String testHello(){
        return hello.hello();
    }

    @GetMapping("testGetUser")
    public MyResponse testHello(int id){
        ResponseEntity<ResponseJson> m = hello.get(id);
        return MyResponse.getMyResponse(m);
    }

}
